﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="editor.aspx.cs" Inherits="TradeTestWeb.editor" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnsave").click(function () {
                $.post("editor.aspx/save", { xml: $("#textxml").val() }, function (json) {
                    if (json == null) {
                        $("#msg").attr("class", "showtip");
                        var date = new Date();
                        var time = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
                        $("#msg").text(time + "  保存成功");
                        setTimeout(function () {
                            $("#msg").attr("class", "hidetip");
                        }, 3000);

                    } else {
                        alert(json.error);
                    }
                }, "json");
            });

        });
    </script>
    <style type="text/css">
        .showtip
        {
            border-bottom: solid;
            border-width: 1px;
            border-color: #008000;
            background-color: #80FF80;
            text-align: center;
        }
        .hidetip
        {
            border-bottom: solid;
            border-width: 1px;
            border-color: #FFFFFF;
            background-color: #FFFFFF;
            text-align: center;
            color: White;
        }
    </style>
</head>
<body style="margin: 0px">
    <form id="form1" runat="server">
    <div id="msg" class="hidetip">
        2012-12-8 13:20:07 保存成功!
    </div>
    <div style="margin: 2px 15px 2px 15px;">
        <textarea runat="server" id="textxml" style="width: 100%; height: 100%;"></textarea>
        <input type="button" value="保存" id="btnsave" />
        <input type="button" value="预览" id="btnview" />
    </div>
    </form>
</body>
</html>
